﻿/*************************************点击表格行改变颜色**********************************************/
var oldObj;
function itemOnClick(obj){
   if(oldObj != null){
      oldObj.className="MnsOut";	
	  obj.className="MnsDow";	
   }else{
	  obj.className="MnsDow";
   }
   oldObj=obj;
}
function setCurrentRow(obj){
	itemOnClick(obj);
}
/*************************************表格记录复选框选择**********************************************/
function setChecked(boxGroupName,checkboxName) {
	f=document.forms[0];
	if(f.elements[checkboxName].checked){
		f.elements[checkboxName].checked=false;
	}else{
		f.elements[checkboxName].checked=true;
	}
	for( i=0 ; i<f.elements.length ; i++) {
		if (f.elements[i].type=="checkbox"&&f.elements[i].name!=checkboxName && checkboxName.indexOf(boxGroupName)!=-1) {		
			f.elements[i].checked=false;
		}
	}
}
function getCheckedId(boxGroupName){
	if(boxGroupName=="" || boxGroupName==undefined){
		boxGroupName="recCheck"
	}
	var checkBoxName;
	f=document.forms[0];
	for( i=0 ; i<f.elements.length ; i++) {
		checkBoxName=f.elements[i].name;
		if (f.elements[i].type=="checkbox" && checkBoxName.indexOf(boxGroupName)!=-1) {		
			if(f.elements[i].checked){
				return f.elements[i].value;
			}
		}
	}
	return "";
}
/*************************************多选下拉框选项移动**********************************************/
function moveSelected(oSourceSel,oTargetSel)
 {
     var arrSelValue = new Array();
     var arrSelText = new Array();
     var arrValueTextRelation = new Array();
     var index = 0;
     for(var i=0; i<oSourceSel.options.length; i++)
     {
         if(oSourceSel.options[i].selected)
         {
             arrSelValue[index] = oSourceSel.options[i].value;
             arrSelText[index] = oSourceSel.options[i].text;
             arrValueTextRelation[arrSelValue[index]] = oSourceSel.options[i];
             index ++;
         }
     }
     for(var i=0; i<arrSelText.length; i++)  
     {
     	if(!optionIsExist(oTargetSel,arrSelValue[i])){
     	  oTargetSel.options.add(new Option(arrSelText[i],arrSelValue[i]));
     	}        
        oSourceSel.removeChild(arrValueTextRelation[arrSelValue[i]]);
     }
 }
 function optionIsExist(oTargetSel,sValue){
 	for(var i=0;i<oTargetSel.options.length;i++){
 		if(oTargetSel.options[i].value==sValue){
 			return true;
 		}
 	}
 	return false;
 }